package br.com.monitor.testesDeUnidade;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import br.com.monitor.modelos.InformacoesPessoais;


/**
 *
 * @author Projeto Monitor
 */

public class TesteInformacoesPessoais {
	
	InformacoesPessoais info;
	
	@Before public void testConstrutor() {
		try {
			info = new InformacoesPessoais("testando", "123456");
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
			Assert.fail();
		}
		
		try {
			info = new InformacoesPessoais("julioLeitao", "123123123");
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
			Assert.fail();
		}
		
	}
	
	@Test public void testGettersAndSetters() {
		Assert.assertEquals("julioLeitao", info.getLogin());
		Assert.assertEquals("123123123", info.getSenha());
		
		try {
			info.setLogin(null);
			Assert.fail();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
		}

		try {
			info.setLogin("");
			Assert.fail();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
		}
		
		try {
			info.setLogin("999");
			Assert.fail();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
		}
		
		try {
			info.setSenha(null);
			Assert.fail();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
		}
		
		try {
			info.setSenha("123");
			Assert.fail();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getStackTrace());
		}
		
	}
	
}
